//    Copyright (C) Kherty.  All rights reserved.
using System.Windows;
using System.Windows.Input;

namespace OpenLS.Chart.UI
{
    partial class ValueAxis3DResources
    {
        public ValueAxis3DResources()
        {
            InitializeComponent();
        }
        static readonly ValueAxis3DResources _singleton = new ValueAxis3DResources();
        public static DataTemplate ValueAxis3DTemplate { get { return (DataTemplate)_singleton["ValueAxis3DTemplate"]; } }
        public static Style HorizontalNumericValueContainerStyle { get { return (Style)_singleton["HorizontalNumericValueContainerStyle"]; } }
        public static Style VerticalNumericValueContainerStyle { get { return (Style)_singleton["VerticalNumericValueContainerStyle"]; } }
        public static DataTemplate NumericValueLabelTemplate { get { return (DataTemplate)_singleton["NumericValueLabelTemplate"]; } }
        public static DataTemplate NumericValueTickTemplate { get { return (DataTemplate)_singleton["NumericValueTickTemplate"]; } }

        private void OnFormatAxis(object sender, ExecutedRoutedEventArgs e)
        {
            var axis = AxisElement.GetAxis((DependencyObject)sender);
            PropertyHelper.ShowPropertiesFor(axis, sender as FrameworkElement, ChartCommands.FormatAxis.Text, PropertyTabHint.None);
            e.Handled = true;
        }

        private void OnAddMajorGridLines(object sender, ExecutedRoutedEventArgs e)
        {
            var axis = (Axis)e.Parameter;
            axis.MajorGridLines = new ChartLines();
            e.Handled = true;
        }
        private void OnAddMinorGridLines(object sender, ExecutedRoutedEventArgs e)
        {
            var axis = (Axis)e.Parameter;
            axis.MinorGridLines = new ChartLines();
            e.Handled = true;
        }
        private void OnFormatMajorGridLines(object sender, ExecutedRoutedEventArgs e)
        {
            var axis = (Axis)e.Parameter;
            if (axis.MajorGridLines == null)
                return;
            PropertyHelper.ShowPropertiesFor(axis.MajorGridLines, sender as FrameworkElement, ChartCommands.FormatMajorGridLines.Text, PropertyTabHint.None);
            e.Handled = true;
        }
        private void OnFormatMinorGridLines(object sender, ExecutedRoutedEventArgs e)
        {
            var axis = (Axis)e.Parameter;
            if (axis.MinorGridLines == null)
                return;
            PropertyHelper.ShowPropertiesFor(axis.MinorGridLines, sender as FrameworkElement, ChartCommands.FormatMinorGridLines.Text, PropertyTabHint.None);
            e.Handled = true;
        }

        private void OnDelete(object sender, ExecutedRoutedEventArgs e)
        {
            var axis = (Axis)e.Parameter;
            axis.Delete = true;
            e.Handled = true;
        }
        private void OnCanAddMajorGridLines(object sender, CanExecuteRoutedEventArgs e)
        {
            var axis = (Axis)e.Parameter;
            e.CanExecute = axis.MajorGridLines == null;
            e.Handled = true;
        }
        private void OnCanAddMinorGridLines(object sender, CanExecuteRoutedEventArgs e)
        {
            var axis = (Axis)e.Parameter;
            e.CanExecute = axis.MinorGridLines == null && axis.MajorGridLines != null;
            e.Handled = true;
        }

        private void OnCanFormatMajorGridLines(object sender, CanExecuteRoutedEventArgs e)
        {
            var axis = (Axis)e.Parameter;
            e.CanExecute = axis.MajorGridLines != null;
            e.Handled = true;
        }
        private void OnCanFormatMinorGridLines(object sender, CanExecuteRoutedEventArgs e)
        {
            var axis = (Axis)e.Parameter;
            e.CanExecute = axis.MinorGridLines != null;
            e.Handled = true;
        }


    }
}
